﻿@{
    ViewBag.Title = "updaHospital";
    Layout = "~/Views/Shared/_ViewMenu.cshtml";
}

@model  List<ZX.HIS.Model.Hospital> 
@using ZX.HIS.Model;

<div id="urHere">DouPHP 管理中心<b>&gt;</b><strong>挂号信息</strong> </div>
<div style="width:100%">
    <div class="mainBox" style="height:auto!important;height:550px;min-height:550px;">
        <h3><a href="/Hospital/Index" class="actionBtn ">返回</a>修改诊所信息</h3>
        <table width="100%" border="0" class="table table-bordered  tableBasic">
            <tr>
                <td width="140" align="right">诊所名称：</td>
@foreach(var i in Model)
            {
                <td><input id="HospitalName" type="text" class="inpMain" size="40" value="@i.HospitalName" /></td>
}
            </tr>
            <tr>
                <td align="right">诊所地址：</td>
@foreach(var p in Model)
            {
                <td><input id="HospitalAddre" type="text" class="inpMain" size="40" value="@p.HospitalAddre" /></td>
}
            </tr>
            <tr>
                <td><input id="Button1" type="button" class="btn" value="取消" onclick="closseHospital()" /></td>
@foreach(var t in Model)
            {
                <td>
                    <input id="Button1" type="button" class="btn" value="保存" onclick="updatHospital(@t.HospitalId)" />
                    
                </td>
}
            </tr>
        </table>
    </div>

</div>
<script>
    function closseHospital() {
        location.href = '/Hospital/Index';
    }
    function updatHospital(HospitalId) {
        var HospitalName = $("#HospitalName").val();
        var HospitalAddre = $("#HospitalAddre").val();
        $.ajax({
            type: 'POST',
            url: '/Hospital/updaHospitaldo',
            data: {

                HospitalName: HospitalName, HospitalAddre: HospitalAddre, HospitalId: HospitalId
            },
            dataType: 'Json',
            success: function (data) {
                if (data == 1) {
                    alert("修改成功！");
                    // $("#sp1").html("　");
                    location.href = '/Hospital/Index';
                } else {
                    alert("修改失败！");
                }
            }

        })
    }
</script>
